using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace VotingSystem.Models
{
    public class QuestionOption
    {
        [Key]
        public int Id { get; set; }

        [Required]
        public int QuestionId { get; set; }

        [Required]
        [StringLength(200)]
        public string OptionText { get; set; } = string.Empty;

        public int Order { get; set; }

        [ForeignKey("QuestionId")]
        public SurveyQuestion? Question { get; set; }

        public virtual ICollection<OptionResponse> OptionResponses { get; set; } = new List<OptionResponse>();

        public int ResponseCount => OptionResponses.Count;

        public QuestionOption()
        {
            OptionResponses = new List<OptionResponse>();
        }
    }
} 